/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.fallback.trade;

import com.enation.app.javashop.core.client.feignimpl.trade.PintuanClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.promotion.pintuan.Pintuan;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 商品分词熔断
 *
 * @author zh
 * @version v7.0
 * @date 18/9/27 下午3:15
 * @since v7.0
 */
@Component
public class PintuanClientFallbackFactory extends BaseFallbackFactory<PintuanClientFeignImpl> implements FallbackFactory {

    @Override
    protected PintuanClientFeignImpl fallback() {
        return new PintuanClientFallback();
    }

    /**
     * 商品分词熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午3:15
     * @since v7.0
     */
    @Component
    public static class PintuanClientFallback implements PintuanClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public Pintuan getModel(Long id) {

            logger.error("获取拼团出错");
            return null;
        }


        @Override
        public List<Pintuan> get(String status) {
            logger.error("获取拼团列表出错");
            return null;
        }

        @Override
        public void closePromotion(Long promotionId) {
            logger.error("closePromotion出错");
        }

        @Override
        public void openPromotion(Long promotionId) {
            logger.error("openPromotion出错");

        }
    }
}
